/*! @file Damage.h
 *  Definiton of damage.
 */
#include "MersenneTwister.h"
#include "Exception.h"
#include "Size.h"
#include <iostream>
#ifndef DAMAGE_H
#define DAMAGE_H

/*! @enum Sides
 *  @brief List of possible sides of dices of damage.
 */
enum Sides {
	_NULL, /*!< Special side. Not a dice, but an abstration of no damage.*/
	_1, /*!< Special side. Not a dice, but an abstration of damage equals to 1.*/
	d2, /*!< Special side. Not a dice, but an abstration of d4/2.*/
	d3, /*!< Special side. Not a dice, but an abstration of d6/2.*/
	d4, /*!< 4-sided dice.*/
	d6, /*!< 6-sided dice.*/
	d8, /*!< 8-sided dice.*/
	d10, /*!< 10-sided dice.*/
	d12 /*!< 12-sided dice.*/
};

/*! @class Damage
 *  @brief Base class of damage.
 */
class Damage {
	private:
			MTRand* randomizer;
			int numberOfDices;
			Sides numberOfSides;
			size damageSize;
	public:
			/*! Default Constructor.
			 *  @param numberOfDices number of dices of damage.
			 *  @param numberOfSides number of sides of the dices.
			 *  @param damageSize damage's size.
			 *  @throw Exception::NumberOfDicesException if numberOfDices is below 1 (one).
			 */
			Damage (int numberOfDices, Sides numberOfSides, size damageSize) throw (Exception::NumberOfDicesException);
			
			/*! Returns the number of dices of damage. */
			int getNumberOfDices();
			/*! Returns the number of sides of the dices. */
			int getDiceSides();
			/*! Returns the damage's size. */
			size getSize();
			
			/*! Returns a pseudo-random value between n and n*s, where n is the number of dices and s is the number of sides. */
			int roll ();
			/*! Returns a pseudo-random value between n+bonus and (n*s)+bonus, where n is the number of dices and s is the number of sides.
			 *  @param bonus integer to be added to the result.
			 */
			int roll (int bonus);

			/*! Returns the damage modified to the given size. It follows the pattern below:\n\t
			 *  1 > 1d2 > 1d3 > 1d4 > 1d6 > 1d8 > 2d6 > 3d6 > 4d6 > 6d6 > 8d6 > 12d6\n\t
			 *  1d10 > 2d8 > 3d8 > 4d8 > 6d8 > 8d8 > 12d8
			 */
			Damage toSize (size toSize);
			
			/*! Returns the Sides correspondent of an integer. (default: _NULL) */
			static Sides intToSides (int i);
};

#endif
